package top.rushpeak.edu03.core.enums;


import java.util.EnumSet;
import java.util.HashMap;
import java.util.Map;

/**
 * 缓存统一管理，name主要是注释用，value是缓存key的前缀
 * @author Administrator
 *
 */
public enum CacheType{
	JSessionID("JSessionID","单点登录");


	private String value;
	private String name;
	CacheType(String value,String name) {
		this.value = value;
		this.name = name;
	}
	

    private static final Map<String, CacheType> lookup = new HashMap<String, CacheType>();
    static {
        for (CacheType s : EnumSet.allOf(CacheType.class))
            lookup.put(s.toValue(), s);
    }

    /**
     * 获取枚举的值（整数值、字符串值等）
     * @return
     */
    public String toValue() {
        return this.value;
    }
    
    public String toName() {
        return this.name;
    }
    

    /**
     * 根据值（整数值、字符串值等）获取相应的枚举类型
     * @param value
     * @return
     */
    public static CacheType fromValue(String value) {
        return lookup.get(value);
    }
}
